//
//  MyVoiceSystemViewController.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/26.
//

#import "MyVoiceSystemViewController.h"
#import "MyVoiceSystemCell.h"

@interface MyVoiceSystemViewController ()<UITableViewDelegate,UITableViewDataSource>{
    UITableView *_Tabview;
    MyVoiceSystemCell *Cell;
}

@end

@implementation MyVoiceSystemViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];
    //隐藏头部view
    self.navigationController.navigationBar.hidden = YES;
    NavigationHeadView *navgationheadv = [[NavigationHeadView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, SafeAreaTopHight)];
    navgationheadv.titlelabel.text = @"我的语音系统";
    navgationheadv.titlelabel.textColor = [UIColor blackColor];
    navgationheadv.backbtn.hidden = NO;
    [navgationheadv.backbtn addTarget:self action:@selector(returnback) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:navgationheadv];
 
    UIButton *cityBtn = [[UIButton alloc]initWithFrame:CGRectMake(15, SafeAreaTopHight, APPwidth-30, 30)];
    [cityBtn setTitle:@"所在城市" forState:0];
    cityBtn.contentHorizontalAlignment = 1;
    [cityBtn setTitleColor:rgba(51, 51, 51, 1) forState:0];
    cityBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
    [self.view addSubview:cityBtn];
    
    UIButton *bmBtn = [[UIButton alloc]initWithFrame:CGRectMake(cityBtn.width-100, 10, 80, 20)];
    [bmBtn setImage:[UIImage imageNamed:@"arrowl"] forState:0];
    [bmBtn setTitle:@"长沙市" forState:0];
    bmBtn.contentHorizontalAlignment = 1;
    [bmBtn setTitleColor:rgba(153, 153, 153, 1) forState:0];
    bmBtn.titleLabel.font = [UIFont systemFontOfSize:12];
    bmBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 60, 0, 0);
    [bmBtn.imageView setContentMode:UIViewContentModeScaleAspectFit];
    bmBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 20);
    [cityBtn addSubview:bmBtn];
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, cityBtn.height+cityBtn.y+10, APPwidth, 10)];
    line.backgroundColor = rgba(245, 245, 250, 1);
    [self.view addSubview:line];
    
    
    UIView *headbackV = [[UIView alloc]initWithFrame:CGRectMake(0, line.height+line.y, APPwidth, 70)];
    [self.view addSubview:headbackV];
    UILabel *typeLab = [[UILabel alloc]initWithFrame:CGRectMake(15,  10, 120, 20)];
    typeLab.text = @"全国通用";
    typeLab.textColor = rgba(51, 51, 51, 1);
    typeLab.textAlignment = 0;
    typeLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [headbackV addSubview:typeLab];
    
    UILabel *dislab = [[UILabel alloc]initWithFrame:CGRectMake(15,  typeLab.frame.size.height + typeLab.frame.origin.y+10, APPwidth-30, 20)];
    dislab.text = @"切换其他版本语音包，您之前的编辑的路线与指令将会保存";
    dislab.textColor = rgba(138, 138, 138, 1);
    dislab.textAlignment = 0;
    dislab.font = [UIFont systemFontOfSize:12];
    [headbackV addSubview:dislab];
    
    
    
    
    
    _Tabview  = [[UITableView alloc]initWithFrame:CGRectMake(0, SafeAreaTopHight+60, APPwidth, APPheight)];
    _Tabview.delegate = self;
    _Tabview.dataSource = self;
    _Tabview.separatorStyle = UITableViewCellSeparatorStyleNone;
    _Tabview.tableHeaderView  = headbackV;
    [self.view addSubview:_Tabview];
    
}
#pragma mark - UITableView DataSource

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 60;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 6;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString * str = @"cell";
    
    Cell  = [tableView dequeueReusableCellWithIdentifier:str];
    if (Cell == nil) {
        
        Cell = [[MyVoiceSystemCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:str];
    }
    
//    Cell.nameLab.text = @"学员:小芒果";
    
    Cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return Cell;
}




-(void)returnback{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark -视图即将出现
-(void)viewWillAppear:(BOOL)animated{
        
    ((TabbarController *)self.tabBarController).tabBarView.hidden = YES;
    
}


@end
